<template>
    <div class="container-content">
        <el-form
            ref="elForm"
            :model="formData"
            :rules="rules"
            size="medium"
            label-width="100px"
        >
            <el-form-item label-width="200px" label="税收分类编码" prop="taxTypeCode">
                <el-input
                    v-model="formData.taxTypeCode"
                    placeholder="请输入编码"
                    clearable
                    :style="{ width: '100%' }"
                >
                </el-input>
            </el-form-item>
            <el-form-item label-width="200px" label="上级编码">
                <el-input
                    v-model="formData.parentCode"
                    placeholder="请输入描述"
                    clearable
                    :style="{ width: '100%' }"
                >
                </el-input>
            </el-form-item>
            <el-form-item
                label-width="200px"
                label="名称"
                prop="title"
            >
                <el-input
                    v-model="formData.title"
                    placeholder="请输入名称"
                    clearable
                    :style="{ width: '100%' }"
                ></el-input>
            </el-form-item>
            <el-form-item
                label-width="200px"
                label="简称"
            >
                <el-input
                    v-model="formData.simpleTitle"
                    placeholder="请输入"
                    clearable
                    :style="{ width: '100%' }"
                ></el-input>
            </el-form-item>
            <el-form-item label-width="200px" label="说明">
                <el-input
                    v-model="formData.taxDesc"
                    placeholder="请输入名称"
                    clearable
                    :style="{ width: '100%' }"
                ></el-input>
            </el-form-item>
            <el-form-item label-width="200px" label="税率">
                <el-input
                    v-model="formData.taxRate"
                    placeholder="请输入名称"
                    clearable
                    :style="{ width: '100%' }"
                ></el-input>
            </el-form-item>
            <el-form-item label-width="200px" label="税收优惠政策内容">
                <el-input
                    v-model="formData.preferentialTaxPolicy"
                    placeholder="请输入名称"
                    clearable
                    :style="{ width: '100%' }"
                ></el-input>
            </el-form-item>
            <el-form-item label-width="200px" label="版本">
                <el-input
                    v-model="formData.taxVersion"
                    placeholder="请输入名称"
                    clearable
                    :style="{ width: '100%' }"
                ></el-input>
            </el-form-item>
            <el-form-item label-width="200px" label="编码">
                <el-input
                    v-model="formData.docNo"
                    placeholder="请输入名称"
                    clearable
                    :style="{ width: '100%' }"
                ></el-input>
            </el-form-item>
            <el-form-item label-width="200px" label="数据状态">
                <el-select
                    v-model="formData.isUsed"
                    placeholder="请选择是否禁用"
                    clearable
                    :style="{ width: '100%' }"
                >
                    <el-option
                        v-for="(item, index) in isDisabledOptions"
                        :key="index"
                        :label="item.label"
                        :value="item.value"
                        :disabled="item.disabled"
                    ></el-option>
                </el-select>
            </el-form-item>
        </el-form>
    </div>
</template>
<script>
import { add } from "@/api/base/data";
export default {
    components: {},
     props: ["id"],
    data() {
        return {
            formData: {
                companyCode: undefined,
                companyDesc: undefined,
                dataStatus: undefined,
                isDisabled: undefined,
                title: undefined,
            },
            rules: {
                taxTypeCode: [
                    {
                        required: true,
                        message: "请输入编码",
                        trigger: "blur",
                    },
                ],
                title: [
                    {
                        required: true,
                        message: "请输入名称",
                        trigger: "blur",
                    },
                ],
            },
            dataStatusOptions: [
                {
                    label: "创建",
                    value: 1,
                },
                {
                    label: "审核中",
                    value: 2,
                },
                {
                    label: "已审核",
                    value: 3,
                },
            ],
            isDisabledOptions: [
                {
                    label: "暂存",
                    value: 1,
                }
            ],
        };
    },
    computed: {},
    watch: {},
    created() {},
    mounted() {},
    methods: {
        submitForm(cb) {
            this.$refs["elForm"].validate((valid) => {
                if (!valid) return;
                // TODO 提交表单
                add(this.formData, "kingBaseTaxType").then(
                    (res) => {
                        if (res.code === 200) {
                            cb();
                            this.$message.success("新增成功");
                        }
                    }
                );
            });
        },
        resetForm() {
            this.$refs["elForm"].resetFields();
        },
    },
};
</script>
<style></style>
